﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrdenVentaItem.ascx.cs" 
Inherits="UILGestion.VentaAdmin.OrdenVenta.OrdenVentaItem" %>
 <%@ Register src="../ProyectoPanel.ascx" tagname="ProyectoPanel" tagprefix="uc4" %>
  <%@ Register assembly="WebLib" namespace="WebLib" tagprefix="lib" %>
 <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
 
<script type="text/javascript">

    function toggle(id) {
        var state = document.getElementById(id).style.display;
        if (state == 'block') {
            document.getElementById(id).style.display = 'none';
        } else {
            document.getElementById(id).style.display = 'block';
        }
    }

</script>
 <input id="internalID" type="hidden" runat="server" />
  <input id="idColeccion" type="hidden" runat="server" />
  <%--<asp:Button ID="addUIBTN" runat="server" Text="Buscar ..."   OnClick="AddGraficaItem"
                                            CssClass="ms-crm-List-Header"  /> --%>



   <asp:GridView ID="itemGridView" runat="server" DataKeyNames="idInternal" ShowFooter="true"
    onrowcancelingedit="CancelItem" 
                            onrowediting="EditItem" 
                            OnRowUpdating="UpdateItem" 
                                 ShowHeaderWhenEmpty="true" SkinID="GridView" >
                                 <Columns>
                                 <asp:TemplateField HeaderStyle-Width="300px" HeaderText="Localizacion">
                                         <ItemTemplate>
                                          <asp:Label ID="Label1" runat="server" Text='<%# Eval("etapa")%>' 
                                                 Width="100px"></asp:Label>
                                             <asp:Label ID="localizacionEditTextBox" runat="server" Text='<%# Eval("localizacion")%>' 
                                                 Width="80px"></asp:Label>
                                                 <asp:Label ID="pisoTextBox" runat="server" BackColor="Transparent" 
                                                 Text='<%# Eval("piso")%>'  />
                                         </ItemTemplate>
                                         <EditItemTemplate>
                                          <lib:Input ID="etapaTXT" runat="server" BackColor="Transparent" Text='<%# Eval("etapa")%>'
                                                 ReadOnly="true" Width="100px" />
                                             <lib:Input ID="localizacionEditTextBox" runat="server" BackColor="Transparent"  ReadOnly="true"
                                                 Text='<%# Eval("localizacion")%>' Width="80px" />
                                                 <lib:Input ID="pisoTextBox" runat="server" BackColor="Transparent"  ReadOnly="true"
                                                 Text='<%# Eval("piso")%>' Width="80px" />
                                         </EditItemTemplate>
                                         <FooterTemplate>
                                         <lib:Input ID="etapaTXT" runat="server" BackColor="Transparent" 
                                                 ReadOnly="true" Width="100px" />
                                             <lib:Input ID="localizacionEditTextBox" runat="server" BackColor="Transparent" 
                                                 ReadOnly="true" Width="80px" />
                                                 <lib:Input ID="pisoTextBox" runat="server" BackColor="Transparent" 
                                                 ReadOnly="true" Width="80px" />

                                         </FooterTemplate>
                                     </asp:TemplateField>
                                     <asp:TemplateField HeaderStyle-Width="70px" HeaderText="Codigo">
                                         <ItemTemplate>
                                             <asp:Label ID="codigoLabel" runat="server" Text='<%# Eval("codigo")%>' 
                                                 Width="70px"></asp:Label>
                                         </ItemTemplate>
                                         <EditItemTemplate>
                                             <asp:Label ID="codigoEditTextBox" runat="server" BackColor="Transparent" 
                                                 Text='<%# Eval("codigo")%>'  />
                                         </EditItemTemplate>
                                         <FooterTemplate>
                                             <lib:Input ID="codigoEditTextBox" runat="server" BackColor="Transparent" 
                                                 ReadOnly="true" Width="70px" />
                                         </FooterTemplate>
                                     </asp:TemplateField>
                                     <asp:TemplateField  HeaderText="Nro Lote /Dpto">
                                         <EditItemTemplate>
                                             <lib:Input ID="descripcionEditTextBox" runat="server" DataType="List"   
                                             Text='<%# Eval("descripcion")%>'
                                               method="GetUI" OnSelect="SelectUI" Width="150"   
                                               ChkVal='<%# int.Parse((string)Request.QueryString["idProyecto"])%>'   ></lib:Input>

                                                 <lib:Input ID="descripcionEdit1TextBox" runat="server" BackColor="Transparent"  
                                                 Text='<%# Eval("descripcion")%>'
                                                 ReadOnly="true" Width="0px" />
                                             <lib:Input ID="idUITXT" runat="server" BackColor="Transparent" 
                                             ReadOnly="true" Text='<%# Eval("idUI")%>'
                                                 Width="0px" />

                                         </EditItemTemplate>
                                         <FooterTemplate>
                                       
                                            <lib:Input ID="descripcionEditTextBox" runat="server" DataType="List" 
                                                 method="GetUI" OnSelect="SelectUI" Width="150"  NumColum="0" 
                                                  ChkVal='<%# int.Parse((string)Request.QueryString["idProyecto"])%>'   ></lib:Input>

                                             <lib:Input ID="descripcionEdit1TextBox" runat="server" BackColor="Transparent" 
                                                 ReadOnly="true" Width="0px" />
                                             <lib:Input ID="idUITXT" runat="server" BackColor="Transparent" ReadOnly="true" 
                                                 Width="0px" />
                                         </FooterTemplate>
                                         <ItemTemplate>

                                           <asp:Hyperlink runat= "server"  ForeColor="Blue"
                                           Text='<%# DataBinder.Eval(Container.DataItem,"descripcion").ToString()%>'  
                                           Target="_self"  ID="Hyperlink2"
                                            NavigateUrl='<%# "~/VentaAdmin/UI/UIReadForm.aspx?id=" + 
                                            DataBinder.Eval (Container.DataItem,"idUI").ToString()  +
                                            "&idProyecto=" + DataBinder.Eval (Container.DataItem,"idProyecto").ToString()
                                            %>' 
                                           />   



                                             
                                         </ItemTemplate>
                                     </asp:TemplateField>


                                     <asp:TemplateField ControlStyle-Width="120px" HeaderStyle-Width="120px" 
                                         HeaderText="Precio" ItemStyle-HorizontalAlign="Right">
                                         <ItemTemplate>
                                             <asp:Label ID="totalLabel" runat="server" Text='<%# Eval("totalStr")%>' />
                                         </ItemTemplate>
                                         <EditItemTemplate>
                                             <lib:Input ID="totalTextBox" runat="server" BackColor="Transparent" 
                                                 ReadOnly="true" Text='<%# Eval("totalStr")%>' Width="120px"></lib:Input>
                                         </EditItemTemplate>
                                         <FooterTemplate>
                                             <lib:Input ID="totalTextBox" runat="server" BackColor="Transparent" 
                                                 ReadOnly="true" Width="120px"></lib:Input>
                                         </FooterTemplate>
                                     </asp:TemplateField>

                                     


                                      <asp:TemplateField ControlStyle-Width="50px" HeaderStyle-Width="50px" 
                                         HeaderText="Separación" ItemStyle-HorizontalAlign="Right">
                                         <ItemTemplate>
                                         
                                             <asp:Label id="separacionLBL"  runat="server" 
                                             Text='<%# Eval("totalSeparacion")%>'  />
                                         </ItemTemplate>
                                         <EditItemTemplate>
                                           <lib:Input ID="totalSeparacionTXT" runat="server" DataType="Double" 
                                               Text='<%# Eval("totalSeparacion")%>' Width="80px" />
                                         
                                         </EditItemTemplate>
                                         
                                         <FooterTemplate>
                                            <lib:Input ID="totalSeparacionTXT" runat="server"   DataType="Double"
                                               Width="80px" />
                                            
                                            
                                         </FooterTemplate>
                                     </asp:TemplateField>

                                         <asp:TemplateField ControlStyle-Width="50px" HeaderStyle-Width="50px" 
                                         HeaderText="Financiado" ItemStyle-HorizontalAlign="Right">
                                         <ItemTemplate>
                                             <input id="bitFinanciadoCHK" type="checkbox" runat="server" 
                                             checked= '<%# Eval("bitFinanciado")%>' disabled="disabled" />
                                         </ItemTemplate>
                                         <EditItemTemplate>
                                         <asp:CheckBox runat="server" ID="bitFinanciadoCHK" 
                                         checked= '<%# Eval("bitFinanciado")%>' 
                                         />
                                         <%--
                                         <table>
                                         <tr>
                                         <td align="right">
                                         
                                         OnClick="javascript:toggle('Comments');"
                                                        <div id="Comments"  style="display:none"  >                                            
                                                        </div> 
                                            </td>
                                            <td>
                                            
                                            <lib:Input ID="totalSeparacionTXT" runat="server"  
                                               Text='<%# Eval("totalSeparacion")%>' Width="80px" />
                                            
                                            </td>
                                            </tr>
                                            </table>
                                            --%>
                                         </EditItemTemplate>
                                         
                                         <FooterTemplate>
                                         <asp:CheckBox runat="server" ID="bitFinanciadoCHK"  />
                                         <%--<table>
                                         <tr>
                                         <td align="right"></td>
                                         <td><div id="Comments"  style="display:none"  >                                            
                                            
                                            </div></td>
                                         </tr>
                                         </table>--%>
                                            
                                            
                                            
                                         </FooterTemplate>
                                     </asp:TemplateField>

                                        <asp:CommandField ButtonType="Image" CancelImageUrl="~/Images/cancel.gif" 
                                        EditImageUrl="~/Images/edit.gif" ShowEditButton="true" 
                                        UpdateImageUrl="~/Images/update.gif" />

                                     <asp:TemplateField>
                                         <FooterTemplate>
                                             <asp:Button ID="addProvAdd" runat="server" OnClick="AddItem" Text="Añadir" />

                                             
                                         </FooterTemplate>
                                         <ItemTemplate>
                                             <asp:ImageButton ID="lnkRemove" runat="server" BorderColor="Control" 
                                                 CommandArgument='<%# Eval("idInternal")%>' ImageUrl="~/Images/delete.gif" 
                                                 OnClick="DeleteItem" 
                                                 OnClientClick="return confirm('Usted quiere eliminar?')" />
                                         </ItemTemplate>
                                     </asp:TemplateField>
                                 </Columns>
                             </asp:GridView>


